package com.thread.test.volatileTest;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author huang
 * @version 0.0.1
 * @apiNote TODO
 * @since 2021/6/11 14:41
 **/
public class ThreadSafeByVolInteger {

    //volatile可保证可见性，但是不保证原子性 原子类保证对数据操作的原子性
    private AtomicInteger val = new AtomicInteger(0);

    public AtomicInteger getVal() {
        return this.val;
    }

    public void setVal(AtomicInteger val) {
        this.val = val;
    }
}
